<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>How to build a simple project quickly</title>
    <meta name="description" content="We create an empty console project first:$ xmake create -P ./hellocreate hello ...create ok!👌And xmake will generate some files:$ cd ./hello$ tree ..├── src│...">

    
    <meta name="keywords" content="xmake,build,project,hello,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/2016/07/16/how-to-build-a-simple-project/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/cn?lang=0">
                    
                        <i class="fa fa-home"></i>中文
                    </a>
                </li>

                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>Projects
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/archive/">
                            
                        
                            <i class="fa fa-archive"></i>Archives
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/category/">
                            
                        
                            <i class="fa fa-th-list"></i>Categories
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/tag/">
                            
                        
                            <i class="fa fa-tags"></i>Tags
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/docs/">
                            
                        
                            <i class="fa fa-book"></i>Documents
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="https://xmake.io/#/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>Community
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/donation/">
                            
                        
                            <i class="fa fa-heart"></i>Donate
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/about/">
                            
                        
                            <i class="fa fa-user"></i>About
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                     
                     
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>How to build a simple project quickly</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2016-07-16
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#build" title="Tag: build" rel="tag">build</a-->
        <a href="/tag/#build" title="Tag: build" rel="tag">build</a>&nbsp;
    
        <!--a href="/tag/#project" title="Tag: project" rel="tag">project</a-->
        <a href="/tag/#project" title="Tag: project" rel="tag">project</a>&nbsp;
    
        <!--a href="/tag/#hello" title="Tag: hello" rel="tag">hello</a-->
        <a href="/tag/#hello" title="Tag: hello" rel="tag">hello</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>We create an empty console project first:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake create -P ./hello

create hello ...
create ok!👌
</code></pre>
</div>

<p>And xmake will generate some files:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span><span class="nb">cd</span> ./hello
<span class="gp">$ </span>tree .

.
├── src
│   └── main.c
└── xmake.lua
</code></pre>
</div>

<p>It is a simple console program only for printing <code class="highlighter-rouge">hello xmake!</code></p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>cat ./src/main.c 

<span class="c">#include &lt;stdio.h&gt;</span>
int main<span class="o">(</span>int argc, char<span class="k">**</span> argv<span class="o">)</span>
<span class="o">{</span>
    <span class="nb">printf</span><span class="o">(</span><span class="s2">"hello xmake!</span><span class="se">\n</span><span class="s2">"</span><span class="o">)</span>;
    <span class="k">return </span>0;
<span class="o">}</span>
</code></pre>
</div>

<p>The content of <code class="highlighter-rouge">xmake.lua</code> is very simple:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="err">$</span> <span class="n">cat</span> <span class="n">xmake</span><span class="p">.</span><span class="n">lua</span> 

<span class="n">target</span><span class="p">(</span><span class="s2">"hello"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span> 

</code></pre>
</div>

<p>We build it now.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake

checking <span class="k">for </span>the architecture ... x86_64
checking <span class="k">for </span>the Xcode SDK version <span class="k">for </span>macosx ... 10.11
checking <span class="k">for </span>the target minimal version ... 10.11
checking <span class="k">for </span>the c compiler <span class="o">(</span>cc<span class="o">)</span> ... xcrun -sdk macosx clang
checking <span class="k">for </span>the c++ compiler <span class="o">(</span>cxx<span class="o">)</span> ... xcrun -sdk macosx clang
checking <span class="k">for </span>the objc compiler <span class="o">(</span>mm<span class="o">)</span> ... xcrun -sdk macosx clang
checking <span class="k">for </span>the objc++ compiler <span class="o">(</span>mxx<span class="o">)</span> ... xcrun -sdk macosx clang++
checking <span class="k">for </span>the assember <span class="o">(</span>as<span class="o">)</span> ... xcrun -sdk macosx clang
checking <span class="k">for </span>the linker <span class="o">(</span>ld<span class="o">)</span> ... xcrun -sdk macosx clang++
checking <span class="k">for </span>the static library archiver <span class="o">(</span>ar<span class="o">)</span> ... xcrun -sdk macosx ar
checking <span class="k">for </span>the static library extractor <span class="o">(</span>ex<span class="o">)</span> ... xcrun -sdk macosx ar
checking <span class="k">for </span>the shared library linker <span class="o">(</span>sh<span class="o">)</span> ... xcrun -sdk macosx clang++
checking <span class="k">for </span>the swift compiler <span class="o">(</span>sc<span class="o">)</span> ... xcrun -sdk macosx swiftc
checking <span class="k">for </span>the debugger <span class="o">(</span>dd<span class="o">)</span> ... xcrun -sdk macosx lldb
configure
<span class="o">{</span>
    ex <span class="o">=</span> <span class="s2">"xcrun -sdk macosx ar"</span>
,   ccache <span class="o">=</span> <span class="s2">"ccache"</span>
,   plat <span class="o">=</span> <span class="s2">"macosx"</span>
,   ar <span class="o">=</span> <span class="s2">"xcrun -sdk macosx ar"</span>
,   buildir <span class="o">=</span> <span class="s2">"build"</span>
,   as <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang"</span>
,   sh <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang++"</span>
,   arch <span class="o">=</span> <span class="s2">"x86_64"</span>
,   mxx <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang++"</span>
,   xcode_dir <span class="o">=</span> <span class="s2">"/Applications/Xcode.app"</span>
,   target_minver <span class="o">=</span> <span class="s2">"10.11"</span>
,   sc <span class="o">=</span> <span class="s2">"xcrun -sdk macosx swiftc"</span>
,   mode <span class="o">=</span> <span class="s2">"release"</span>
,   make <span class="o">=</span> <span class="s2">"make"</span>
,   cc <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang"</span>
,   host <span class="o">=</span> <span class="s2">"macosx"</span>
,   dd <span class="o">=</span> <span class="s2">"xcrun -sdk macosx lldb"</span>
,   kind <span class="o">=</span> <span class="s2">"static"</span>
,   ld <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang++"</span>
,   xcode_sdkver <span class="o">=</span> <span class="s2">"10.11"</span>
,   cxx <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang"</span>
,   mm <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang"</span>
<span class="o">}</span>
configure ok!
clean ok!
<span class="o">[</span>00%]: ccache compiling.release src/main.c
<span class="o">[</span>100%]: linking.release hello
build ok!👌
</code></pre>
</div>

<p>And we run this program:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake run hello

hello world!
</code></pre>
</div>

<p>Or we can debug it.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake run -d hello 

<span class="o">[</span>lldb]<span class="nv">$target</span> create <span class="s2">"build/hello"</span>
Current executable <span class="nb">set </span>to <span class="s1">'build/hello'</span> <span class="o">(</span>x86_64<span class="o">)</span>.
<span class="o">[</span>lldb]<span class="nv">$b</span> main
Breakpoint 1: where <span class="o">=</span> hello<span class="sb">`</span>main, address <span class="o">=</span> 0x0000000100000f50
<span class="o">[</span>lldb]<span class="nv">$r</span>
Process 7509 launched: <span class="s1">'/private/tmp/hello/build/hello'</span> <span class="o">(</span>x86_64<span class="o">)</span>
Process 7509 stopped
<span class="k">*</span> thread <span class="c">#1: tid = 0x435a2, 0x0000000100000f50 hello`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>
    frame <span class="c">#0: 0x0000000100000f50 hello`main</span>
hello<span class="sb">`</span>main:
<span class="gp">-&gt;  </span>0x100000f50 &lt;+0&gt;:  pushq  %rbp
    0x100000f51 &lt;+1&gt;:  movq   %rsp, %rbp
    0x100000f54 &lt;+4&gt;:  leaq   0x2b<span class="o">(</span>%rip<span class="o">)</span>, %rdi          ; <span class="s2">"hello world!"</span>
    0x100000f5b &lt;+11&gt;: callq  0x100000f64               ; symbol stub <span class="k">for</span>: puts
<span class="o">[</span>lldb]<span class="err">$</span>
</code></pre>
</div>

<p>Next we build it for android.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p android --ndk<span class="o">=</span>~/files/android-ndk-r10e/

checking <span class="k">for </span>the architecture ... armv7-a
checking <span class="k">for </span>the SDK version of NDK ... android-21
checking <span class="k">for </span>the c compiler <span class="o">(</span>cc<span class="o">)</span> ... arm-linux-androideabi-gcc
checking <span class="k">for </span>the c++ compiler <span class="o">(</span>cxx<span class="o">)</span> ... arm-linux-androideabi-g++
checking <span class="k">for </span>the assember <span class="o">(</span>as<span class="o">)</span> ... arm-linux-androideabi-gcc
checking <span class="k">for </span>the linker <span class="o">(</span>ld<span class="o">)</span> ... arm-linux-androideabi-g++
checking <span class="k">for </span>the static library archiver <span class="o">(</span>ar<span class="o">)</span> ... arm-linux-androideabi-ar
checking <span class="k">for </span>the static library extractor <span class="o">(</span>ex<span class="o">)</span> ... arm-linux-androideabi-ar
checking <span class="k">for </span>the shared library linker <span class="o">(</span>sh<span class="o">)</span> ... arm-linux-androideabi-g++
configure
<span class="o">{</span>
    ex <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar"</span>
,   ccache <span class="o">=</span> <span class="s2">"ccache"</span>
,   ndk <span class="o">=</span> <span class="s2">"~/files/android-ndk-r10e/"</span>
,   sc <span class="o">=</span> <span class="s2">"xcrun -sdk macosx swiftc"</span>
,   ar <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar"</span>
,   ld <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++"</span>
,   buildir <span class="o">=</span> <span class="s2">"build"</span>
,   host <span class="o">=</span> <span class="s2">"macosx"</span>
,   as <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc"</span>
,   toolchains <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin"</span>
,   arch <span class="o">=</span> <span class="s2">"armv7-a"</span>
,   mxx <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang++"</span>
,   xcode_dir <span class="o">=</span> <span class="s2">"/Applications/Xcode.app"</span>
,   target_minver <span class="o">=</span> <span class="s2">"10.11"</span>
,   ndk_sdkver <span class="o">=</span> 21
,   mode <span class="o">=</span> <span class="s2">"release"</span>
,   cc <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc"</span>
,   cxx <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++"</span>
,   make <span class="o">=</span> <span class="s2">"make"</span>
,   dd <span class="o">=</span> <span class="s2">"xcrun -sdk macosx lldb"</span>
,   kind <span class="o">=</span> <span class="s2">"static"</span>
,   sh <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++"</span>
,   xcode_sdkver <span class="o">=</span> <span class="s2">"10.11"</span>
,   plat <span class="o">=</span> <span class="s2">"android"</span>
,   mm <span class="o">=</span> <span class="s2">"xcrun -sdk macosx clang"</span>
<span class="o">}</span>
configure ok!

<span class="gp">$ </span>xmake

clean ok!
<span class="o">[</span>00%]: ccache compiling.release src/main.c
<span class="o">[</span>100%]: linking.release hello
build ok!👌
</code></pre>
</div>

<p>Or we build it for iphoneos.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p iphoneos

checking <span class="k">for </span>the architecture ... armv7
checking <span class="k">for </span>the Xcode SDK version <span class="k">for </span>iphoneos ... 9.2
checking <span class="k">for </span>the target minimal version ... 9.2
checking <span class="k">for </span>the c compiler <span class="o">(</span>cc<span class="o">)</span> ... xcrun -sdk iphoneos clang
checking <span class="k">for </span>the c++ compiler <span class="o">(</span>cxx<span class="o">)</span> ... xcrun -sdk iphoneos clang
checking <span class="k">for </span>the objc compiler <span class="o">(</span>mm<span class="o">)</span> ... xcrun -sdk iphoneos clang
checking <span class="k">for </span>the objc++ compiler <span class="o">(</span>mxx<span class="o">)</span> ... xcrun -sdk iphoneos clang++
checking <span class="k">for </span>the assember <span class="o">(</span>as<span class="o">)</span> ... gas-preprocessor.pl xcrun -sdk iphoneos clang
checking <span class="k">for </span>the linker <span class="o">(</span>ld<span class="o">)</span> ... xcrun -sdk iphoneos clang++
checking <span class="k">for </span>the static library archiver <span class="o">(</span>ar<span class="o">)</span> ... xcrun -sdk iphoneos ar
checking <span class="k">for </span>the static library extractor <span class="o">(</span>ex<span class="o">)</span> ... xcrun -sdk iphoneos ar
checking <span class="k">for </span>the shared library linker <span class="o">(</span>sh<span class="o">)</span> ... xcrun -sdk iphoneos clang++
checking <span class="k">for </span>the swift compiler <span class="o">(</span>sc<span class="o">)</span> ... xcrun -sdk iphoneos swiftc
configure
<span class="o">{</span>
    ex <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos ar"</span>
,   ccache <span class="o">=</span> <span class="s2">"ccache"</span>
,   ndk <span class="o">=</span> <span class="s2">"~/files/android-ndk-r10e/"</span>
,   sc <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos swiftc"</span>
,   ar <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos ar"</span>
,   sh <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang++"</span>
,   buildir <span class="o">=</span> <span class="s2">"build"</span>
,   xcode_dir <span class="o">=</span> <span class="s2">"/Applications/Xcode.app"</span>
,   as <span class="o">=</span> <span class="s2">"/usr/local/share/xmake/tools/utils/gas-preprocessor.pl xcrun -sdk iphoneos clang"</span>
,   toolchains <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin"</span>
,   arch <span class="o">=</span> <span class="s2">"armv7"</span>
,   mxx <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang++"</span>
,   ndk_sdkver <span class="o">=</span> 21
,   target_minver <span class="o">=</span> <span class="s2">"9.2"</span>
,   cc <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang"</span>
,   mode <span class="o">=</span> <span class="s2">"release"</span>
,   host <span class="o">=</span> <span class="s2">"macosx"</span>
,   cxx <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang"</span>
,   make <span class="o">=</span> <span class="s2">"make"</span>
,   dd <span class="o">=</span> <span class="s2">"xcrun -sdk macosx lldb"</span>
,   kind <span class="o">=</span> <span class="s2">"static"</span>
,   ld <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang++"</span>
,   xcode_sdkver <span class="o">=</span> <span class="s2">"9.2"</span>
,   plat <span class="o">=</span> <span class="s2">"iphoneos"</span>
,   mm <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang"</span>
<span class="o">}</span>
configure ok!

<span class="gp">$ </span>xmake
 
<span class="o">[</span>00%]: ccache compiling.release src/main.c
<span class="o">[</span>100%]: linking.release hello
build ok!👌
</code></pre>
</div>

<p>Last, we attempt to build it for mingw.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p mingw --sdk<span class="o">=</span>/usr/local/i386-mingw32-4.3.0/

checking <span class="k">for </span>the architecture ... i386
checking <span class="k">for </span>the c compiler <span class="o">(</span>cc<span class="o">)</span> ... i386-mingw32-gcc
checking <span class="k">for </span>the c++ compiler <span class="o">(</span>cxx<span class="o">)</span> ... i386-mingw32-g++
checking <span class="k">for </span>the assember <span class="o">(</span>as<span class="o">)</span> ... i386-mingw32-gcc
checking <span class="k">for </span>the linker <span class="o">(</span>ld<span class="o">)</span> ... i386-mingw32-g++
checking <span class="k">for </span>the static library archiver <span class="o">(</span>ar<span class="o">)</span> ... i386-mingw32-ar
checking <span class="k">for </span>the static library extractor <span class="o">(</span>ex<span class="o">)</span> ... i386-mingw32-ar
checking <span class="k">for </span>the shared library linker <span class="o">(</span>sh<span class="o">)</span> ... i386-mingw32-g++
checking <span class="k">for </span>the swift compiler <span class="o">(</span>sc<span class="o">)</span> ... no
configure
<span class="o">{</span>
    ex <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-ar"</span>
,   ccache <span class="o">=</span> <span class="s2">"ccache"</span>
,   ndk <span class="o">=</span> <span class="s2">"~/files/android-ndk-r10e/"</span>
,   sc <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos swiftc"</span>
,   sdk <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/"</span>
,   cc <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc"</span>
,   ndk_sdkver <span class="o">=</span> 21
,   buildir <span class="o">=</span> <span class="s2">"build"</span>
,   plat <span class="o">=</span> <span class="s2">"mingw"</span>
,   as <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc"</span>
,   toolchains <span class="o">=</span> <span class="s2">"/Users/ruki/files/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin"</span>
,   arch <span class="o">=</span> <span class="s2">"i386"</span>
,   mxx <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang++"</span>
,   xcode_dir <span class="o">=</span> <span class="s2">"/Applications/Xcode.app"</span>
,   target_minver <span class="o">=</span> <span class="s2">"9.2"</span>
,   sh <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++"</span>
,   mode <span class="o">=</span> <span class="s2">"release"</span>
,   host <span class="o">=</span> <span class="s2">"macosx"</span>
,   cxx <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++"</span>
,   make <span class="o">=</span> <span class="s2">"make"</span>
,   dd <span class="o">=</span> <span class="s2">"xcrun -sdk macosx lldb"</span>
,   kind <span class="o">=</span> <span class="s2">"static"</span>
,   ar <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-ar"</span>
,   xcode_sdkver <span class="o">=</span> <span class="s2">"9.2"</span>
,   ld <span class="o">=</span> <span class="s2">"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++"</span>
,   mm <span class="o">=</span> <span class="s2">"xcrun -sdk iphoneos clang"</span>
<span class="o">}</span>
configure ok!

<span class="gp">$ </span>xmake

<span class="o">[</span>00%]: ccache compiling.release src/main.c
<span class="o">[</span>100%]: linking.release hello.exe
build ok!👌
</code></pre>
</div>

<p>xmake can build project directly on cmd if your system is windows and it will check your vs tools automatically.</p>

<p>.e.g</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake

checking <span class="k">for </span>the architecture ... x86
checking <span class="k">for </span>the Microsoft Visual Studio version ... 2008
checking <span class="k">for </span>the c compiler <span class="o">(</span>cc<span class="o">)</span> ... cl.exe
checking <span class="k">for </span>the c++ compiler <span class="o">(</span>cxx<span class="o">)</span> ... cl.exe
checking <span class="k">for </span>the assember <span class="o">(</span>as<span class="o">)</span> ... ml.exe
checking <span class="k">for </span>the linker <span class="o">(</span>ld<span class="o">)</span> ... link.exe
checking <span class="k">for </span>the static library archiver <span class="o">(</span>ar<span class="o">)</span> ... link.exe -lib
checking <span class="k">for </span>the shared library linker <span class="o">(</span>sh<span class="o">)</span> ... link.exe -dll
checking <span class="k">for </span>the static library extractor <span class="o">(</span>ex<span class="o">)</span> ... lib.exe
configure
<span class="o">{</span>
    ex <span class="o">=</span> <span class="s2">"lib.exe"</span>
,   sh <span class="o">=</span> <span class="s2">"link.exe -dll"</span>
,   host <span class="o">=</span> <span class="s2">"windows"</span>
,   ar <span class="o">=</span> <span class="s2">"link.exe -lib"</span>
,   as <span class="o">=</span> <span class="s2">"ml.exe"</span>
,   plat <span class="o">=</span> <span class="s2">"windows"</span>
,   buildir <span class="o">=</span> <span class="s2">"build"</span>
,   arch <span class="o">=</span> <span class="s2">"x86"</span>
,   cc <span class="o">=</span> <span class="s2">"cl.exe"</span>
,   cxx <span class="o">=</span> <span class="s2">"cl.exe"</span>
,   mode <span class="o">=</span> <span class="s2">"release"</span>
,   clean <span class="o">=</span> <span class="nb">true</span>
,   kind <span class="o">=</span> <span class="s2">"static"</span>
,   ld <span class="o">=</span> <span class="s2">"link.exe"</span>
,   vs <span class="o">=</span> <span class="s2">"2008"</span>
<span class="o">}</span>
configure ok!
<span class="o">[</span>00%]: compiling.release src<span class="se">\m</span>ain.c
<span class="o">[</span>100%]: linking.release hello.exe
build ok!
</code></pre>
</div>

        </article>
        <hr>

        <!-- baidu ads -->
        

        
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="chinese">中文</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/cn/2016/07/16/how-to-build-a-simple-project/">如何快速构建一个简单的程序
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
        
            </ul>
        

        
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">Similar Posts</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 released, Switch to Lua5.4 runtime, Support Rust and C++ mixed compilation
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 released, Improve C++20 Modules and support Nim, Keil MDK and Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>Prev Post</strong> <a href="/2016/07/16/batch-check-functions/">Batch checking library functions</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        

        

        

        
        
        <p><strong>Next Post</strong> <a href="/2016/07/17/demo-build-a-simple-project/">Demo: Build a simple project</a></p>
        
    </div>
</div>


        <h2 id="comments">Comments</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,      
  language: 'en',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">


            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    Content
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#chinese">中文</a></li>
                    <li><a href="#similar_posts">Similar Posts</a></li>
                    <li><a href="#comments">Comments</a></li>
                </ul>
            </div>

            <!-- baidu ads -->
            

            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

            <!-- chitika ads -->
            
        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
